Dynomotion

Group: DynoMotion Message: 99 From: babinda01 Date: 1/12/2010
Subject: KFlop/KAnalog Wiring
Hi Tom (or other knowledgable chaps)

I am nearing completion of wiring up my first control box (10 more to go after this one), and have a quick question.
I am using the Kflop and Kanalog boards, but I am wanting to use step and direction pulses to my servo drives, so I am doing this by disconnectiong the RJ45 cable from the Kflop board (JP5) and wiring my servo's into this connector, while all other inputs and ouputs are using the optoed interface on the Kanalog board. Can you please tell me if this is ok to do.
I am only using 3 axis so I am wiring them to pins 1-6 on the RJ45. Also are these outputs (step and direction) sinking or sourcing, or should I say is it best to sink or source using these connections?

Regards
Andrew
Group: DynoMotion Message: 100 From: TK Date: 1/12/2010
Subject: Re: KFlop/KAnalog Wiring

Hi Andrew,

 

Yes you may disconnect JP5 and use it for step and direction.  You will loose Kanalog differential inputs 8-15 however.  Differential inputs 0-7 (4 encoder A B signals) will still be available.

 

JP5 has pins for step and direction generators 4-7.  Configuring as output channels 4-7 will drive the pins as open collector (sinking) outputs.  When open the pins are allowed to float to +4V before the ESD diodes clamp them to the 3.3V power rail.  So they will sink most optos connected to +5V as long as the opto turns off with 1V or less.  I haven’t heard of a case where this was a problem.

 

Otherwise you may configure them as output channels12-15 and they will operate as 3.3V LVTTL outputs (basically source and sink but only to ~3.3V and 0V).

 

Regards

TK

 

Group: DynoMotion Message: 101 From: babinda01 Date: 1/12/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Thanks for the prompt reply.
That all sound great to me, except loosing differentials 8-15. I am not running my encoder A or B back to the Kanalog but I am running the Z and not Z for each axis for homing purposes. Can I run these Z pulses to differential 0-7?

Regards
Andrew

--- In DynoMotion@yahoogroups.com, "TK" <tk@...> wrote:
>
> Hi Andrew,
>
>
>
> Yes you may disconnect JP5 and use it for step and direction. You will
> loose Kanalog differential inputs 8-15 however. Differential inputs 0-7 (4
> encoder A B signals) will still be available.
>
>
>
> JP5 has pins for step and direction generators 4-7. Configuring as output
> channels 4-7 will drive the pins as open collector (sinking) outputs. When
> open the pins are allowed to float to +4V before the ESD diodes clamp them
> to the 3.3V power rail. So they will sink most optos connected to +5V as
> long as the opto turns off with 1V or less. I haven't heard of a case where
> this was a problem.
>
>
>
> Otherwise you may configure them as output channels12-15 and they will
> operate as 3.3V LVTTL outputs (basically source and sink but only to ~3.3V
> and 0V).
>
>
>
> Regards
>
> TK
>
>
>
> _____
>
> From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> Behalf Of babinda01
> Sent: Tuesday, January 12, 2010 12:30 AM
> To: DynoMotion@yahoogroups.com
> Subject: [DynoMotion] KFlop/KAnalog Wiring
>
>
>
>
>
> Hi Tom (or other knowledgable chaps)
>
> I am nearing completion of wiring up my first control box (10 more to go
> after this one), and have a quick question.
> I am using the Kflop and Kanalog boards, but I am wanting to use step and
> direction pulses to my servo drives, so I am doing this by disconnectiong
> the RJ45 cable from the Kflop board (JP5) and wiring my servo's into this
> connector, while all other inputs and ouputs are using the optoed interface
> on the Kanalog board. Can you please tell me if this is ok to do.
> I am only using 3 axis so I am wiring them to pins 1-6 on the RJ45. Also are
> these outputs (step and direction) sinking or sourcing, or should I say is
> it best to sink or source using these connections?
>
> Regards
> Andrew
>
Group: DynoMotion Message: 102 From: babinda01 Date: 1/12/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Thanks for the promp reply.
Sounds great except for the loosing differentails 8-15.
I am not running the A or B of my encoders back to the Kanalog, but I am running the Z and not Z back, for homing purposes. Can I just run the Z pulses back the differentials 0-7?

Regards
Andrew

--- In DynoMotion@yahoogroups.com, "TK" <tk@...> wrote:
>
> Hi Andrew,
>
>
>
> Yes you may disconnect JP5 and use it for step and direction. You will
> loose Kanalog differential inputs 8-15 however. Differential inputs 0-7 (4
> encoder A B signals) will still be available.
>
>
>
> JP5 has pins for step and direction generators 4-7. Configuring as output
> channels 4-7 will drive the pins as open collector (sinking) outputs. When
> open the pins are allowed to float to +4V before the ESD diodes clamp them
> to the 3.3V power rail. So they will sink most optos connected to +5V as
> long as the opto turns off with 1V or less. I haven't heard of a case where
> this was a problem.
>
>
>
> Otherwise you may configure them as output channels12-15 and they will
> operate as 3.3V LVTTL outputs (basically source and sink but only to ~3.3V
> and 0V).
>
>
>
> Regards
>
> TK
>
>
>
> _____
>
> From: DynoMotion@yahoogroups.com [mailto:DynoMotion@yahoogroups.com] On
> Behalf Of babinda01
> Sent: Tuesday, January 12, 2010 12:30 AM
> To: DynoMotion@yahoogroups.com
> Subject: [DynoMotion] KFlop/KAnalog Wiring
>
>
>
>
>
> Hi Tom (or other knowledgable chaps)
>
> I am nearing completion of wiring up my first control box (10 more to go
> after this one), and have a quick question.
> I am using the Kflop and Kanalog boards, but I am wanting to use step and
> direction pulses to my servo drives, so I am doing this by disconnectiong
> the RJ45 cable from the Kflop board (JP5) and wiring my servo's into this
> connector, while all other inputs and ouputs are using the optoed interface
> on the Kanalog board. Can you please tell me if this is ok to do.
> I am only using 3 axis so I am wiring them to pins 1-6 on the RJ45. Also are
> these outputs (step and direction) sinking or sourcing, or should I say is
> it best to sink or source using these connections?
>
> Regards
> Andrew
>
Group: DynoMotion Message: 103 From: TK Date: 1/12/2010
Subject: Re: KFlop/KAnalog Wiring

Yes

 

Group: DynoMotion Message: 105 From: babinda01 Date: 1/22/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Another quick question, I have wired in my boards and I am trying to test and configure my settings, but when I start the KMotion suite and go to the Digital i/o screen I notice bits 8 - 15 on the Kflop are flickering the state of these pins - is this normal????

Andrew
Group: DynoMotion Message: 106 From: babinda01 Date: 1/22/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Another quick question, I have wired in my boards and I am trying to test and configure my settings, but when I start the KMotion suite and go to the Digital i/o screen I notice bits 8 - 15 on the Kflop are flickering the state of these pins - is this normal????

Andrew
Group: DynoMotion Message: 107 From: Tom Kerekes Date: 1/22/2010
Subject: Re: KFlop/KAnalog Wiring
Yes.  Those are the pins used to do the communication to Kanalog.
 
TK

Group: DynoMotion Message: 108 From: babinda01 Date: 1/22/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Thanks for the info.

OK I am onto my next problem (by the time I get all 10 machines ready I will be an expert).....I am now setting up Mach3 and I have set the plugin as layed out in the manual. My initalize program is listed below, for spindle control I am using the spindlemach3.c program and the homemach3.c for homing and notifymach3.c for the notify program. I have set the plugin to Initialize every Mach reset.

When I turn the system on, the Kanalog starts as expected and the switch/enable all fet activates, but when I click the reset button in Mach to eneable the system this fet turnes off. What function from mach controls this??

Andrew

#include "KMotionDef.h"

// Defines axis 0, 1, 2 as simple step dir outputs
// enables them
// sets them as an xyz coordinate system for GCode

int main()
{
ch0->InputMode=NO_INPUT_MODE;
ch0->OutputMode=STEP_DIR_MODE;
ch0->Vel=40000.000000;
ch0->Accel=400000.000000;
ch0->Jerk=4000000.000000;
ch0->P=0.000000;
ch0->I=0.010000;
ch0->D=0.000000;
ch0->FFAccel=0.000000;
ch0->FFVel=0.000000;
ch0->MaxI=200.000000;
ch0->MaxErr=1000000.000000;
ch0->MaxOutput=200.000000;
ch0->DeadBandGain=1.000000;
ch0->DeadBandRange=0.000000;
ch0->InputChan0=0;
ch0->InputChan1=0;
ch0->OutputChan0=0;
ch0->OutputChan1=0;
ch0->LimitSwitchOptions=0x0;
ch0->InputGain0=1.000000;
ch0->InputGain1=1.000000;
ch0->InputOffset0=0.000000;
ch0->InputOffset1=0.000000;
ch0->invDistPerCycle=1.000000;
ch0->Lead=0.000000;
ch0->MaxFollowingError=1000000000.000000;
ch0->StepperAmplitude=20.000000;

ch0->iir[0].B0=1.000000;
ch0->iir[0].B1=0.000000;
ch0->iir[0].B2=0.000000;
ch0->iir[0].A1=0.000000;
ch0->iir[0].A2=0.000000;

ch0->iir[1].B0=1.000000;
ch0->iir[1].B1=0.000000;
ch0->iir[1].B2=0.000000;
ch0->iir[1].A1=0.000000;
ch0->iir[1].A2=0.000000;

ch0->iir[2].B0=0.000769;
ch0->iir[2].B1=0.001538;
ch0->iir[2].B2=0.000769;
ch0->iir[2].A1=1.920810;
ch0->iir[2].A2=-0.923885;
EnableAxisDest(0,0);

ch1->InputMode=NO_INPUT_MODE;
ch1->OutputMode=STEP_DIR_MODE;
ch1->Vel=40000.000000;
ch1->Accel=400000.000000;
ch1->Jerk=4000000.000000;
ch1->P=0.000000;
ch1->I=0.010000;
ch1->D=0.000000;
ch1->FFAccel=0.000000;
ch1->FFVel=0.000000;
ch1->MaxI=200.000000;
ch1->MaxErr=1000000.000000;
ch1->MaxOutput=200.000000;
ch1->DeadBandGain=1.000000;
ch1->DeadBandRange=0.000000;
ch1->InputChan0=1;
ch1->InputChan1=0;
ch1->OutputChan0=1;
ch1->OutputChan1=0;
ch1->LimitSwitchOptions=0x0;
ch1->InputGain0=1.000000;
ch1->InputGain1=1.000000;
ch1->InputOffset0=0.000000;
ch1->InputOffset1=0.000000;
ch1->invDistPerCycle=1.000000;
ch1->Lead=0.000000;
ch1->MaxFollowingError=1000000000.000000;
ch1->StepperAmplitude=20.000000;

ch1->iir[0].B0=1.000000;
ch1->iir[0].B1=0.000000;
ch1->iir[0].B2=0.000000;
ch1->iir[0].A1=0.000000;
ch1->iir[0].A2=0.000000;

ch1->iir[1].B0=1.000000;
ch1->iir[1].B1=0.000000;
ch1->iir[1].B2=0.000000;
ch1->iir[1].A1=0.000000;
ch1->iir[1].A2=0.000000;

ch1->iir[2].B0=0.000769;
ch1->iir[2].B1=0.001538;
ch1->iir[2].B2=0.000769;
ch1->iir[2].A1=1.920810;
ch1->iir[2].A2=-0.923885;
EnableAxisDest(1,0);

ch2->InputMode=NO_INPUT_MODE;
ch2->OutputMode=STEP_DIR_MODE;
ch2->Vel=40000.000000;
ch2->Accel=400000.000000;
ch2->Jerk=4000000.000000;
ch2->P=0.000000;
ch2->I=0.010000;
ch2->D=0.000000;
ch2->FFAccel=0.000000;
ch2->FFVel=0.000000;
ch2->MaxI=200.000000;
ch2->MaxErr=1000000.000000;
ch2->MaxOutput=200.000000;
ch2->DeadBandGain=1.000000;
ch2->DeadBandRange=0.000000;
ch2->InputChan0=2;
ch2->InputChan1=0;
ch2->OutputChan0=2;
ch2->OutputChan1=0;
ch2->LimitSwitchOptions=0x0;
ch2->InputGain0=1.000000;
ch2->InputGain1=1.000000;
ch2->InputOffset0=0.000000;
ch2->InputOffset1=0.000000;
ch2->invDistPerCycle=1.000000;
ch2->Lead=0.000000;
ch2->MaxFollowingError=1000000000.000000;
ch2->StepperAmplitude=20.000000;

ch2->iir[0].B0=1.000000;
ch2->iir[0].B1=0.000000;
ch2->iir[0].B2=0.000000;
ch2->iir[0].A1=0.000000;
ch2->iir[0].A2=0.000000;

ch2->iir[1].B0=1.000000;
ch2->iir[1].B1=0.000000;
ch2->iir[1].B2=0.000000;
ch2->iir[1].A1=0.000000;
ch2->iir[1].A2=0.000000;

ch2->iir[2].B0=0.000769;
ch2->iir[2].B1=0.001538;
ch2->iir[2].B2=0.000769;
ch2->iir[2].A1=1.920810;
ch2->iir[2].A2=-0.923885;

EnableAxisDest(2,0);
DefineCoordSystem(0,1,2,-1);

return 0;
}
Group: DynoMotion Message: 109 From: babinda01 Date: 1/22/2010
Subject: Re: KFlop/KAnalog Wiring
Tom
I have set the Estop input pin in Mach3 to 136 (opto Input 0), and after I click apply and go back into the config i/o section of mach it shows the estop pin as -120. Is this normal, or have I done something esle wronge.

Andrew
Group: DynoMotion Message: 110 From: babinda01 Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Just one more question before I give up for the day.
When I write my init program am I correct in saying that because I am getting my step and driection pulses from the JP5 connector on my kflop board these will be chan 4 - 7? And if so because I am using step and direction pulses with no inputs I set my X axis(ch4) to OutputChan0=8 and OutputChan1=9 and Y axis to 10 and 11 etc etc?????
I have wired my step and direction signals so that 5V goes from the KAnalog board to my servo drives and then by step and direction pulses are sinking.

Regards
Andrew
Group: DynoMotion Message: 111 From: Tom Kerekes Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
It sounds like you have the the polarity wrong.
 
In Mach3 Config Ports and Pins - Motor Outputs - Dir Low Active
 
TK

Group: DynoMotion Message: 112 From: Tom Kerekes Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
Andrew,
 
I think Mach3 stores the I/O Pin number as a signed byte with a range of -128 ... +127 so a value greater than 127 wraps around to a negative value.
 
Does it still work correctly?
 
TK

Group: DynoMotion Message: 113 From: Tom Kerekes Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
Andrew,
 
Yes JP5 has Step/Dir Generators #4 - #7 on it, so connect your X motor driver to 4 and Y to 5
 
No your X Axis (can be any axis channel) should have OutputChan0 = 4, OutputChan1 = don't care
No your Y Axis (can be any axis channel) should have OutputChan0 = 5, OutputChan1 = don't care
 
TK

Group: DynoMotion Message: 114 From: babinda01 Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Thanks for the info

I now have mach3 starting up ok, and after pushing the reset button on mach the system initialises, but I still can't get the estop to work. Do I need to add anything to my initialisation program to get the estop to work?

Andrew
Group: DynoMotion Message: 115 From: babinda01 Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom

I am getting back to basics and am trying to get my system working just from the kmotion software(I probably should have done this first).

So I have my motors connected to JP5 can config as ch4, ch5 and ch6. I have tied my step +v side of the opto on my servo drives to 5V on the Kanalog board, and my step and direction pulses from JP5 are going to the step -V side of the opto on my servo drive. When I enable the Kanalog/Kflop system I can see I have 5V on both my Step and Direction Pins out of JP5, but this is measured without the cable plugged into my servo drive. Once I plug it into my servo drives this 5V signal is pulled down to approx 1.9V and my motor starts growling and moving erratically in one direction. Any thoughts on what I could possibly try next?

Andrew
Group: DynoMotion Message: 116 From: Tom Kerekes Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
Andrew,
 
Very odd.  Without your cable plugged in the KFlop outputs should be either floating or pulled low and definately 4.0v or less.  Measuring 5V would be bad.
 
From what you describe your drives are only connected to +5V and should have the effect of pulling the signals up toward +5V.   Yet connecting them pulls the signals down to 1.9V??
 
Please check your wiring and voltage measurements again.
TK

 
Group: DynoMotion Message: 117 From: babinda01 Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Sorry, a VERY bad description there on my part.
The outputs from the Kflop with no connection to the servo drives is 5v measured between the 5v connection and the step or direction pin - so yes the step pin is pulled low (0v to gnd). But as soon as I plug the servo drive in I get 3.1V to gnd or 1.9V to the 5V rail.

Once I connect to the servo drive cable the motor turns very roughly with no command issued. But if I issue a command it does actually turn in the correct direction and if I issue a command in the opposite direction it does turn in the opposite direction.
I have wired my servos as a sinking type of input so the Opto +v is connected directly to the 5v rail of the Kanalog, and then the 0v of the opto is tied to the step or direction pins.

In the manual for the servos it describes the step and direction inputs as follows:
5 - 24V input range
max 2Mhz
Min Pulse width 500nS
Input impedance 700ohm

Also in the drawing of the inputs to the servo drives it shows a diode with a 5.6V zener in series with it, between the anode and cathode of the opto.


Regards
Andrew
Group: DynoMotion Message: 118 From: Tom Kerekes Date: 1/23/2010
Subject: Re: KFlop/KAnalog Wiring
Hmmm.  If the input impedence is really 700 ohms then it should only take ~7ma to pull it to ground and KFlop is rated for 12ma.
 
I can't tell if KFlop isn't able to pull the pin low, or if when it floats high it doesn't go high enough to turn off. 
 
Try this: 
 
#1 Cycle power on KFlop so everything is in the default mode (inputs=floating) and nothing is configured
 
#2 Measure the voltage (relative to ground) on the pin
 
#3 On the Digital I/O screen select the I/O bit as an Output and set the State unchecked (low).
#4 Measure the voltage (relative to ground) on the pin
 
TK

Group: DynoMotion Message: 119 From: babinda01 Date: 1/24/2010
Subject: Re: KFlop/KAnalog Wiring
Hi
Did as you said:
#2 = 3.155V
#4 = 0.175V

Andrew
Group: DynoMotion Message: 120 From: Tom Kerekes Date: 1/24/2010
Subject: Re: KFlop/KAnalog Wiring
Andrew,
 
Looks like the problem is that the opto is not completely turning off.
 
If possible, try adding something like a 1~2 K ohm pull up resistor from the pin to +5V.
Case #2 should then be more like 4V and the opto should see only 1V and turn off.
 
Another option would be to use 3.3V instead of 5V, but then the opto might not turn on reliably.
 
TK

Group: DynoMotion Message: 121 From: babinda01 Date: 1/24/2010
Subject: Re: KFlop/KAnalog Wiring
HiTom
Did as you suggested and put a 1K pull up, and at this stage it is looking like it has fixed the problem. So thanks heaps for your help.
I will have another play tomorrow.

Any thoughts on the estop issue with mach3. I can now jog my machine with the jog buttons in mach, so things are talking correctly. But still I can't get my estop button to work. I have it connected to opto input 0 (bit 136) on the Kanalog board. I can see it toggle on the io screen in Kmotion, but nothing is comming through at the mach3 end. I have even tried another input in mach ie Input No1 but I can't see anything toggle on my mach diagnostics screen. Do I need to add some sort of estop routine to my init code??

Regards
Andrew
Group: DynoMotion Message: 122 From: babinda01 Date: 1/27/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
I am still having trouble getting my inputs to work in Mach3. I can see the bits change (Bit 136) on the KMotion software, and I have configured mach3 input1 to 136, but the led at the mach3 end just blinks erratically whether the switch is made or not.
Any thought on what I should be trying??

Regards
Andrew
Group: DynoMotion Message: 123 From: Tom Kerekes Date: 1/27/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Andrew,
 
Sorry for the delay we were looking into it.  Mach3 only allows "pin" numbers < 128, so that is a problem for Kanalog I/O bits that are greater than this.
 
You might verify this is the problem by assigning Estop to some other I/O bit less than 128.  You might pick some unused KFlop I/O bit, set it as an output, then just toggle it high and low to simulate a connected switch.  You could also write a KFlop C program loop to constantly copy bit 136 to some other Output bit < 128.  
 
But here is a new plugin that should allow I/O bits 128-255 by declaring them as Port #2 in Mach3.  You need to subtract 128 from the KFlop I/O bit number.  So for example your Kanalog opto input bit 136 will be specified in Mach3 as Port #2 Bit 136-128 =  8.
 
Please try it by downloading the following file.  Remove the .v19b from the name and copy it to your <Mach3>\Plugins directory.
 
 
Thanks
TK
 
 
 

Group: DynoMotion Message: 125 From: babinda01 Date: 1/28/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Thanks for your efforts, it looks like the new plug-in works fine. I will be working on it again a little later, so I will let you know how it goes.
Another dumb question for you - in the past I have used the chargepump from mach3 when using a parallel port breakout board. Is there any need to still do this and get the Kflop to monitor this chargepump frequency or is the bit that you set in the plugin config labled "MACH3 OFFLINE DRIVES" a replacement for this function.
Thanks again

Andrew
Group: DynoMotion Message: 126 From: Tom Kerekes Date: 1/28/2010
Subject: Re: KFlop/KAnalog Wiring
Andrew,
 
Regarding the charge pump:  it's not really necessary.  One of the main reasons for using KFlop is to avoid real-time requirements of the PC, Windows, and Mach3.  So you cant really count on Mach3 generating a continuous pulse stream.  If your breakout board needs a charge pump signal you can generate one with KFlop either with a User Program or PWM output.
 
The Mach3 Offline bit in the Dynomotion Configuration is something else.  It will set a KFlop bit depending on if Mach3 is in offline mode or not.  That bit might be used to do something to your hardware like disable motors when Mach3 is Offline.  Or a KFlop User program might monitor the bit and do some other custom action.
Thanks
TK

Group: DynoMotion Message: 127 From: babinda01 Date: 1/28/2010
Subject: Re: KFlop/KAnalog Wiring
Hi Tom
Thanks. What I am wanting to do is have an enable circuit for my servos and spindles. I have a relay connected to "Switch/Enable All"
and I want to 'and' this to another relay that comes on when mach3 is up and running successfully. This controller is going into an electrical enclosure which has a single on/off switch, so when I turn the machine on the Kflop/Kanalog gets powered up and the switch/enable all signal comes on before windows has finished booting. So that is why I need to have another signal coming from mach to complete my enable sequence.

Regards
Andrew
Group: DynoMotion Message: 128 From: Tom Kerekes Date: 1/28/2010
Subject: Re: KFlop/KAnalog Wiring
Andrew,
 
How about turning on an output bit in your KFlop Reset/Init program.  That way after Mach3 comes up and the User pushes Reset the relay comes on.
 
For FET/Relay driver #0 it would be SetBit(152);
 
TK